package cn.pud.exceltool;

import cn.pud.exceltool.Utils.ExcelUtil;

import java.util.*;

/**
 * @Author: Miyako
 * @CreateTime: 2024-11-13  20:48
 * @Description:
 */
public class InsertData {
    public static void main(String[] args) {
        ExcelUtil excelUtil = new ExcelUtil();
        StringBuilder content = new StringBuilder();
        String next = null;
        StringBuilder contents = new StringBuilder();
//        while (true){
//            System.out.println("输入数据:");
//            next = new Scanner(System.in).next();
//            if (next.equals("exit"))
//                break;

//        }
//        String contentString = content.toString();
//        excelUtil.creatExcelColumn("9",contentString,0);
        //父表
        String aTable = "唯一值\n" +
                "平台编号\n" +
                "创建人登陆账号\n" +
                "创建人\n" +
                "创建日期\n" +
                "修改人登陆账号\n" +
                "修改人\n" +
                "修改日期\n" +
                "经营单位\n" +
                "经营单位名称\n" +
                "进出口类型\n" +
                "业务类型\n" +
                "项目代码\n" +
                "是否允许合并报关\n" +
                "货物分类\n" +
                "投单人联系电话\n" +
                "供应商\n" +
                "供应商ID\n" +
                "供应商全称\n" +
                "运输方式\n" +
                "运输方式名称\n" +
                "成交条件\n" +
                "交货地点\n" +
                "BU\n" +
                "付款方式\n" +
                "付款条件\n" +
                "包装方式\n" +
                "包装件数\n" +
                "启运国\n" +
                "启运国\n" +
                "净重(KG)\n" +
                "毛重(KG)\n" +
                "投单日期\n" +
                "厂区需求日期\n" +
                "是否急单\n" +
                "是否运作VMI\n" +
                "进口日期\n" +
                "进口口岸\n" +
                "是否有来源单\n" +
                "业务种类\n" +
                "运输车型\n" +
                "运筹接单人名称\n" +
                "运筹接单人账号\n" +
                "备注(录入)\n" +
                "报关口岸\n" +
                "报关口岸名称\n" +
                "物流供应商\n" +
                "运输工具名称\n" +
                "航次号\n" +
                "主提单号\n" +
                "分提单号\n" +
                "Release NO.\n" +
                "审核意见\n" +
                "件数\n" +
                "签收人姓名\n" +
                "实际到厂时间\n" +
                "备注(收货中心)\n" +
                "状态(控制状态机\n" +
                "数据来源 01:页面新增;02:导入;03:提取\n" +
                "归属部门代码\n" +
                "归属部门名称\n" +
                "归属公司代码\n" +
                "归属公司名称\n" +
                "归属厂别代码\n" +
                "归属厂别名称\n" +
                "录入企业代码\n" +
                "录入企业名称\n" +
                "是否样品\n" +
                "出货地代码\n" +
                "出货地名称\n" +
                "客户需求日期\n" +
                "厂区出货日期\n" +
                "是否引入销单\n" +
                "国内销单来源\n" +
                "客户编号\n" +
                "客户地址\n" +
                "收货人电话\n" +
                "海外销单交易条件\n" +
                "内销销单交易条件\n" +
                "需求部门主管\n" +
                "仓库接单人\n" +
                "运筹派单时间\n" +
                "要求送达时间\n" +
                "一程物流公司\n" +
                "二程物流公司\n" +
                "物流指令备注\n" +
                "运筹备注\n" +
                "公司税号\n" +
                "投单人\n" +
                "报关单表头ID\n" +
                "司机确认书提取  0 未提取(默认)；1 已提取\n" +
                "报关单提取  0 未提取(默认)；1 已提取\n" +
                "运筹派单时间\n";
        //子表
        String bTable = "唯一值\n" +
                "平台编号\n" +
                "创建人登陆账号\n" +
                "创建人\n" +
                "创建日期\n" +
                "修改人登陆账号\n" +
                "修改人\n" +
                "修改日期\n" +
                "经营单位\n" +
                "数据来源 01:页面新增;02:导入;03:提取\n" +
                "序号\n" +
                "采购单号\n" +
                "采购单行号\n" +
                "货物分类\n" +
                "发票号\n" +
                "发票日期\n" +
                "发票行号\n" +
                "进货通知单号\n" +
                "进货通知单行号\n" +
                "料号/临时资产编号\n" +
                "商品名称(中文)\n" +
                "商品名称(英文)\n" +
                "商品名称(泰文)\n" +
                "进货数量\n" +
                "进货单位\n" +
                "生产日期\n" +
                "进货单价\n" +
                "申报数量\n" +
                "申报单位\n" +
                "比例因子(采购单位/法定单位)\n" +
                "发票单价\n" +
                "申报单价\n" +
                "币制\n" +
                "币制名称\n" +
                "进货总价\n" +
                "申报总价\n" +
                "总价(泰铢）\n" +
                "汇率(泰铢）\n" +
                "原产国\n" +
                "设备新/旧\n" +
                "进口日期\n" +
                "净重(KG)\n" +
                "毛重(KG)\n" +
                "包装方式\n" +
                "包装件数\n" +
                "品牌\n" +
                "主要品名\n" +
                "文档编号\n" +
                "BY\n" +
                "报关单号\n" +
                "报关单行号\n" +
                "备注\n" +
                "出货单号\n" +
                "出货单行号\n" +
                "出货日期\n" +
                "销单号\n" +
                "销单行号\n" +
                "海外销单号\n" +
                "海外销单号\n" +
                "订单号\n" +
                "客户订单号\n" +
                "客户需求日期\n" +
                "客户料号\n" +
                "出货单位\n" +
                "出货数量\n" +
                "出货单价\n" +
                "出货总价\n" +
                "出货币制\n" +
                "贸易国\n" +
                "汇率(美元）\n" +
                "汇率(人名币）\n" +
                "海外法人\n" +
                "PO单价\n" +
                "表头ID\n" +
                "数据源表\n" +
                "源表数据唯一值\n" +
                "退运标记  1 已退运 0 未退运(默认)\n" +
                "剩余数量\n";

        String[] aSplit = aTable.split("\r?\n");
        String[] bSplit = bTable.split("\r?\n");

        Set<String> set1 =  new LinkedHashSet<>();
        Set<String> set2 =  new LinkedHashSet<>();

        for (String s: aSplit){
            set1.add(s);
        }
        for (String s: bSplit){
            set2.add(s);
        }

        Set<String> difference2 = new LinkedHashSet<>(set2);  // 创建 set2 的副本
        //获得差集B
        difference2.removeAll(set1);

        int i =0;

        //转换为驼峰命名
        for (String item : set1){
            StringBuilder result = new StringBuilder();
//            String[] split = item.split("_");
//            result.append(split[0].substring(0).toLowerCase());
//            for (int s = 1; s < split.length; s++) {
//                result.append(split[s].substring(0, 1).toUpperCase());
//                result.append(split[s].substring(1).toLowerCase());
//            }
//            content.append("#{coopEntityList[i].");
            content.append(item);
            content.append(",");
//            content.append("},");
        }

        for (String item : difference2){
            StringBuilder result = new StringBuilder();
//            String[] split = item.split("_");
//            result.append(split[0].substring(0).toLowerCase());
//            for (int s = 1; s < split.length; s++) {
//                result.append(split[s].substring(0, 1).toUpperCase());
//                result.append(split[s].substring(1).toLowerCase());
//            }
//            content.append("#{coopEntityList[i].");
            contents.append(item);
            contents.append(",");
//            content.append("},");
        }


        //转换为驼峰命名
//        for (String item : difference2){
//            StringBuilder result = new StringBuilder();
//            String[] split = item.split("_");
//            result.append(split[0].substring(0).toLowerCase());
//            for (int s = 1; s < split.length; s++) {
//                result.append(split[s].substring(0, 1).toUpperCase());
//                result.append(split[s].substring(1).toLowerCase());
//            }
//            contents.append("#{coopEntityList[i].");
//            contents.append(result);
//            contents.append("},");
//        }
        content.append(contents);
//        System.out.println(content);
        excelUtil.creatExcelColumn("76",content.toString(),0);


    }
}
